import { http } from "@/utils/http";

export interface InsertCityInfo {
  name: string;
  type: number;
  parentId: number;
  otherName: string;
  mainImg: string;
  desc: string;
  isShow: number;
  lat: string;
  lon: string;
}

export interface UpdateCityInfoById {
  id: number;
  name: string;
  type: number;
  parentId: number;
  otherName: string;
  mainImg: string;
  desc: string;
  isShow: number;
}

export interface EnableCityInfoById {
  id: number;
  isShow: number;
}

export interface RemoveCityInfoById {
  id: number;
}

export interface QueryCityInfoById {
  id: number;
}

export interface CityDetailVO {
  id: number;
  name: string;
  type: number;
  parentId: number;
  otherName: string;
  mainImg: string;
  desc: string;
  isShow: number;
  lat: string;
  lon: string;
}

export interface QueryCityInfoByCondition extends BizPageReq {
  id?: number;
  name?: string;
  type?: number;
  parentName?: string;
  isShow?: number;
}

export interface CityBaseVO {
  id: number;
  name: string;
  type: number;
  parentId: number;
  otherName: string;
  isShow: number;
  lat: string;
  lon: string;
}
//新增城市信息
export const insertCityInfoApi = (data: InsertCityInfo) => {
  return http.request<BizResponse<Boolean>>("post", "/city/insertCityInfo", {
    data
  });
};
//更新城市信息
export const updateCityInfoApi = (data: UpdateCityInfoById) => {
  return http.request<BizResponse<Boolean>>(
    "post",
    "/city/updateCityInfoById",
    { data }
  );
};
//删除城市信息
export const removeCityInfoByIdApi = (data: RemoveCityInfoById) => {
  return http.request<BizResponse<Boolean>>(
    "post",
    "/city/removeCityInfoById",
    { data }
  );
};

//启禁用城市信息
export const enableCityInfoByIdApi = (data: EnableCityInfoById) => {
  return http.request<BizResponse<Boolean>>(
    "post",
    "/city/enableCityInfoById",
    { data }
  );
};

//查询城市信息详情
export const queryCityInfoByIdApi = (data: QueryCityInfoById) => {
  return http.request<BizResponse<CityDetailVO>>(
    "post",
    "/city/queryCityInfoById",
    { data }
  );
};

//多条件查询城市信息
export const queryCityInfoByConditionApi = (data: QueryCityInfoByCondition) => {
  return http.request<BizPageResponse<BizPageResult<CityBaseVO>>>(
    "post",
    "/city/queryCityInfoByCondition",
    { data }
  );
};
